home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 151-175 / scopedisk171 / nhostbbs / host2.10e.script < prev    next >
Text File  |  1995-03-19  |  31KB  |  1,101 lines

  1. ;*******************************************************
  2. ; NComm HOST SYSTEM
  3. ; Version se below
  4. ;
  5. ; Copyright © 1989 Daniel Bloch ( ->Ver 1.3)
  6. ; Copyright © 1990 Nils-Arne Dahlberg
  7. ;*******************************************************
  8. ; revision history
  9. ; by 1.6 these things are added:
  10. ;    Search for menus, bulletines and messages in separate directories
  11. ;    Private messages for all users
  12. ;    1.7
  13. ;    Private user passwords
  14. ;    1.8
  15. ;    Double menues
  16. ;    1.9
  17. ;    More messages areas
  18. ;    1.91
  19. ;    Packing and download of messages
  20. ;    1.92
  21. ;    UL/DL check
  22. ;    1.93
  23. ;    Remote Backup
  24. ;    Cosysop enabeld
  25. ;    1.94
  26. ;    Using extended hayes setup (all reset z0 gives right setup)
  27. ;    1.95
  28. ;    Removed part of page routine..
  29. ;    1.96
  30. ;    Changes in file menu
  31. ;    1.97
  32. ;    Changes in messages menus
  33. ;    Local mode 
  34. ;    1.98
  35. ;    Cleanup, changing sysop/cosysop versions
  36. ;    1.99
  37. ;    Change of dos-commands in SYsop menu
  38. ;    change of sysop password placement
  39. ;    2.00
  40. ;    Changed placement of U/D load credits
  41. ;    2.01
  42. ;    Fixed a bug in placement of $name"DL" files
  43. ;    Added Possibility to grab bulletines
  44. ;    Added "waiting " at up/download
  45. ;    2.02
  46. ;    Changed packing program to variable, use what you want as sysop
  47. ;    'Return' leaves password change.
  48. ;    2.03
  49. ;    Just a bugfix
  50. ;    2.04
  51. ;    Changed timout command to make a 300 s timeout for logon as well
  52. ;    2.05
  53. ;    Made a small change to shorten the file
  54. ;    2.06
  55. ;    Added features: filetransfer with Ymodem-Batch and Ymodem-G
  56. ;    Print version number from main menu
  57. ;    2.07
  58. ;    A special reboot, or break facility included, I might take this
  59. ;    into an later E-script
  60. ;    2.08
  61. ;    Changed for an error when HOLD-directory is missing, this
  62. ;    directory might be missing due to the fact that BU-progs not
  63. ;    allways copies empty directories
  64. ;   2.09
  65. ;    Changed password routine to not accept nil password
  66. ;   2.10
  67. ;    YABH (Yet Another Bug-Hunt...)
  68. ;    Missed two \" in delete comment part...
  69. ;    Added Start Script in Sysop mode....
  70. ;    removed a IF $ -line, line no 680 somewhere....
  71. ;   2.10E
  72. ;    Back in english, again...
  73.  
  74. SET    $version= "2.10Enad, 901014"
  75.  
  76. ;--------------------------------------------
  77. ; Set these variables to fit your needs
  78. ;--------------------------------------------
  79.     SET    $dir    = "NComm:host/"        ;Directory for misc. files
  80.                         ;base of all other
  81.     SET    $menudir = $dir"menus/"        ;menus here
  82.     SET     $bulldir = $dir"bulletines/"    ;bulletines here
  83.     SET     $msgsdir = $dir"msgs/"        ;messages here
  84.     SET    $userdir = $dir"Users/"        ;heres the users
  85.     SET    $uldir    = $dir"files/"        ;Upload directory
  86.     SET    $dldir    = $dir"files/"        ;Download directory
  87.     SET    $hold    = "NComm:host/hold/"    ;Hold directory
  88.     SET    $apack     = "sys:pack/LHARC a "    ;packing command
  89.     SET    $alist     = "sys:pack/LHARC l "    ;listing command
  90.     SET    $aextract ="sys:pack/LHarc x "  ;extract command
  91.     SET     $arch     = ".lzh"        ;archive extension
  92.     SET    $holdzoo = $dir"files/HOLD"$arch    ;Hold file
  93.     SET    $tmp    = $dir"files/NHS.tmp"    ;Temporary file
  94.     SET    $UlDldir = $dir"fileCredit/"        ;Up & Downloaded files
  95.     SET    $sysop    = $dir"Sysop/"        ;Sysop directory
  96.     SET    $cosysop = $dir"CoSysop/"    ;coSysop directory
  97.     SET    $sysname = "Boringtown BBS"    ;Name of system
  98.     SET    $list     = "C:ls -cEF \"%n %8s %d\\n\""        ;Directory lister
  99.     SET    $MaxBaud = "2400"        ;Modems Maximum Baud
  100.     SET    $doscomm = $dir"Ckomm/"        ;dos commands for remote
  101.     SET    $hostMNPARQ = "FALSE"        ;set to false if not using
  102.                         ;a MNP or ARQ modem
  103. ;All files in hold directory will be deleted at initialization!!!
  104.  
  105. ;-------------------- M A I N   P R O G R A M -----------------------;
  106.     message    "\f"        ;Clear screen
  107. main:    clrstack
  108.     gosub    init        ;Initialize various stuff
  109.     gosub    connect        ;Wait for RING and answer the phone
  110.     timeout    300 goto bibi   ;must have it here i think..
  111.     when    "\r\nNO CARRIER\r\n" goto NoCarrier
  112.     gosub    prelog        ;Show opening picture
  113.     gosub    login        ;Get name & password
  114.     timeout    300 goto bibi   ;must have it here i think..
  115.     IF    exists $sysop$name THEN goto SysopLogin
  116.     IF    !EXISTS $cosysop$name then goto user
  117. SysopLogin:
  118.     SET     $sysacc = "TRUE"
  119.     IF    !EXISTS $cosysop$name then goto realsysop
  120.     SET    $cosys = "TRUE"
  121.     IF    EXISTS $cosysop$name$pass THEN goto OK
  122.     gosub    logout
  123.     goto    main
  124. RealSysop:
  125.     IF    exists $sysop$name$pass THEN goto OK
  126.     send    "Wrong!!\n"
  127.     write    $dir"log" "\n"$date"  Wrong SYSOP password: "$pass"\n"
  128.     gosub    logout
  129.     goto    main
  130. user:    SET     $sysacc = "FALSE"
  131.     IF    EXISTS $userdir$name$pass THEN goto OK
  132.     send    "Wrong!\n"
  133.     write    $dir"log" "\n"$date"  "$name"  Wrong password: "$pass"\n"
  134.     gosub    login
  135.     IF    EXISTS $userdir$name$pass THEN goto OK
  136.     send    "Wrong!!\n"
  137.     write    $dir"log" "\n"$date"  "$name"  Wrong password: "$pass"\n"
  138.     gosub    logout
  139.     goto     main
  140.  
  141. ;User has logged in
  142. OK:    write    $dir"log" "\n"$date"  Login: "$name" ("$baud")\n"
  143.     send    "\n\nYour last logon was:\n"
  144.     ascsend    $userdir$name$pass
  145.     CLI    "delete >nil: \""$userdir$name$pass"\""
  146.     write    $userdir$name$pass $date"\n"
  147.     gosub    postlog
  148.     timeout 2
  149.     echo    off
  150.     send    "^[[97x"
  151.     input    $id "\r"
  152.     timeout    300 goto bibi   ;must have it here i think..
  153.     echo    on
  154.     send    "\nPress [ENTER] to continue..."
  155.     input    $dummy "\r"
  156.     send    "\f"
  157.     IF    !EXISTS $msgsdir$name then goto OK1
  158.     Send     "\n\nYou have messages waiting.\n"
  159.     send    "==========================\n\n"
  160. OK1:    ascsend    $menudir".menu0"
  161.     
  162. ;This is the main loop
  163. loop:    gosub    MainMenu
  164.     send    "Are you sure you want to loggoff (Enter=Y)? "
  165.     input    $cmd "\r"
  166.     IF $cmd == "N" THEN goto loop
  167.     send    "\n"
  168.     gosub    logout
  169.     goto    main
  170.  
  171.  
  172.  
  173.  
  174. ;--------------------- S U B R O U T I N E S ----------------------
  175.  
  176.  
  177. ;********************************************************
  178. ;* Initialize the system
  179. ;********************************************************
  180. init:    config    $dir"host.config"
  181.     hangup
  182.     converse "OK" "\w\w\w+++\w\w\w\wATZ0\n"    ;Reset to saved setup 0
  183.     converse "OK" "\w\w\wATS7=60\n"    ;Wait one full minute for carrier
  184.     wait    "OK"
  185.     SET    $sysacc = "FALSE"
  186.     SET    $cosys = "FALSE"
  187.     echo    off
  188.     dwhens
  189.     timeout    0
  190.     CLI    "delete >nil: "$hold"#?"
  191.     write    $hold$sysname $sysname"\n Is running on version "$version"\n"
  192.     return
  193.  
  194.  
  195. ;********************************************************
  196. ;* Wait for CONNECT
  197. ;********************************************************
  198. connect:
  199.         dwhens
  200.     send    " \r"
  201.     gosub    skip
  202. conn0:    SET    $Local = "FALSE"
  203.     message    "\n\n\n"$sysname"   [Press '?' for help]\n"
  204.     message    "Waiting on cal...\n"
  205. ConnW:    timeout 300 Goto DoExitQ    ; just wait for 5 minutes
  206.     input    $char ""    ;Get one character
  207.     timeout 90 goto noconnect
  208.     IF !$char == "?" THEN goto conn1
  209.     message "\n\nSpace = Local loggon (turn the modem off first!)\n"
  210.     goto    conn0
  211. conn1:    IF $char == " " THEN goto Local
  212.     IF $char == "R" Then goto Local2
  213. conn2:
  214.     when    "CONNECT 1200" goto conn1200
  215.     when    "CONNECT 2400" goto conn2400
  216.     when    "CONNECT 4800" goto conn4800
  217.     when    "CONNECT 9600" goto conn9600
  218.     dtenths    7
  219.     SET    $baud = $MaxBaud
  220.     send    "\n\w\wAT\w\wA\n"
  221.     timeout 90 goto noconnect
  222.     wait    "NO CARRIER"
  223. NoConnect:
  224.     write    $dir"log" "\n\n"$date"  Login Failed\n\n"
  225.     gosub    init
  226.     goto connect
  227.  
  228. conn3:    dwhens
  229.     timeout 300 goto bibi
  230.     echo    on
  231.     gosub    skip
  232.     return
  233.  
  234. Local:    message    "\nStarting local logon..."
  235.     SET    $baud = "19200"
  236.     SET    $Local = "TRUE"
  237.     goto     conn3
  238.  
  239. Local2:    message    "\nStarting local/remote logon.."
  240.     SET    $baud = "19200"
  241.     goto     conn3
  242.  
  243. QuitNHS:
  244.     config    "NComm:NComm.config"
  245.     end
  246.  
  247. conn1200:
  248.     SET    $baud = "1200"
  249.     goto    conn3
  250. conn2400:
  251.     SET    $baud = "2400"
  252.     goto     conn3
  253. conn4800:
  254.     SET    $baud = "4800"
  255.     goto    conn3
  256. conn9600:
  257.     SET    $baud = "9600"
  258.     goto     conn3
  259. ;**************************************************************************
  260. ; Check if another program wants NHS to quit.
  261. ; In that case, a file named NHSQUIT shuld be placed in the RAM:C directory
  262. ; you should also let the startup-sequence place DELETE there
  263. ; The place of the file may be changed.
  264. ; The Script tells it is quiting by removing this file
  265. ;***************************************************************************
  266. DoExitQ:
  267.     IF !EXISTS "RAM:C/NHSQUIT" THEN goto ConnW
  268.     Hangup    ; shouldnt be nececeray
  269.     CLI "RAM:C/DELETE RAM:C/NHSQUIT"
  270.     QUIT
  271.     END
  272.  
  273. ;********************************************************
  274. ;* Show "prelog", i.e. the picture to be shown before
  275. ;* login.
  276. ;********************************************************
  277. prelog:    send    "\f"$sysname" ("$baud") up on "$date"\n"
  278.     send    $NComm" / NComm Host System (NHS) v"$version"\n"
  279.     send    "Copyright (c) 1989 Daniel Bloch (-> ver 1.3)\n"
  280.     send    "Copyright (c) 1990 Nils-Arne Dahlberg\n\n"
  281.     ascsend    $dir"prelog"
  282.     return
  283.  
  284.  
  285. ;********************************************************
  286. ;* Show "postlog", i.e. the picture to be shown after
  287. ;* login.
  288. ;********************************************************
  289. postlog:
  290.     send    "\n\n"
  291.     ascsend    $dir"postlog"
  292. ;    CLI    "cookie"
  293.     return
  294.  
  295.  
  296. ;********************************************************
  297. ;* Read user name and password into the variables
  298. ;* $name and $pass.  
  299. ;********************************************************
  300. Login:    echo    on
  301.     timeout 120 goto LogSleep
  302.     send    "\n\nYour name: "
  303.     input    $name "\r"
  304.     IF    $name == "new" then goto NewUser
  305. NilPass:
  306.     send    "\nYour password: "
  307.     echo     off
  308.     input    $pass "\r"
  309.     echo    on
  310.     IF    $pass == "" then goto NilPass
  311.         timeout 300 goto bibi
  312.     send    "\n"
  313.     return
  314. LogSleep:
  315.     send    "\n\nLogon terminated after 2 minutes\n"
  316.     gosub    logout
  317.     goto     main
  318.  
  319. NewUser:
  320.     ascsend $dir"newuser"
  321. Newname:
  322.     send    "\n\nYour name: "
  323.     input    $name "\r"
  324.     send    "\n"$name" Correct? (y/N)"
  325.     input    $ok "\r"
  326.     IF    !$ok == "y" then goto Newname
  327.     send    "\nYour password: "
  328.     echo     off
  329.     input    $pass "\r"
  330.     echo    on
  331.     write    $userdir$name        $date"\n"
  332.     write    $userdir$name$pass    $date"\n"
  333.     write    $dir"User" $name" (Ordinary user)\n"
  334.     write    $dir"log" $date"\n\n  New User: "$name"\n"
  335.     timeout 300 goto bibi
  336.     send    "\n"
  337.     return
  338.  
  339. ;********************************************************
  340. ;Skip junk from the modem
  341. ;********************************************************
  342. skip:    timeout 3 goto SkipOK
  343. more:    wait    ""
  344.     goto more
  345. SkipOK:    timeout 300 goto bibi
  346.     return
  347.  
  348.  
  349. ;********************************************************
  350. ;* Log out
  351. ;********************************************************
  352. logout:    CLI    "fortune"
  353.     ascsend $dir"Logout"
  354.     hangup
  355.     write    $dir"log" $date"  Logout: "$name"\n"
  356.     CLI    "delete >nil: "$holdzoo" "$hold"#?"
  357.     write    $hold$sysname $sysname"\n Kör med verision "$version"\n"
  358.     return
  359.  
  360. ;********************************************************
  361. ;* User sleeps
  362. ;********************************************************
  363. bibi:    send     "\n\nGood night!"
  364.     write    $dir"log" $date"  Sleep disconect\n"
  365.     gosub    logout
  366.     goto    main
  367.  
  368. ;********************************************************
  369. ;Main menu
  370. ;********************************************************
  371. MainMenu:
  372.     send    "\nCommand (? el ! for menu): "
  373.     input    $cmd "\r"
  374.     send    "\n"
  375.     IF $cmd == "?" THEN ascsend $menudir".menu0"
  376.     IF $cmd == "!" THEN ascsend $menudir"menu0"
  377.     IF $cmd == "G" THEN return
  378.     IF $cmd == "F" THEN gosub FileMenu
  379.     IF $cmd == "B" THEN gosub BullMenu
  380.     IF $cmd == "O" THEN gosub page
  381.     IF $cmd == "S" THEN gosub sysop
  382.     IF $cmd == "C" THEN gosub Comment
  383.     IF $cmd == "M" THEN gosub Messages
  384.     IF $cmd == "E" THEN gosub LetterMenu
  385.     IF $cmd == "P" THEN gosub ChangePasswd
  386.     IF $cmd == "L" THEN gosub ListUsers
  387.     IF $cmd == "V" THEN send "Verision:"$version"\n"
  388.     goto    MainMenu
  389.  
  390.  
  391. ;********************************************************
  392. ;Chat with SYSOP
  393. ;********************************************************
  394. page:    send     "\Calling SYSOP...\n"
  395.     send    "(press Ctrl-Z to end the conversation)\n"
  396.     beep
  397.     dtenths 3
  398.     beep
  399.     dtenths 3
  400.     beep
  401.     write    $dir"log" $date"  Paged operator\n"
  402.     when    "^Z" goto EndChat
  403. chat:    input    $dummy    "\r"
  404.     send    "\n"
  405.     goto    chat
  406. EndChat:
  407.     dlwhen
  408.     send     "\n"
  409.     return
  410.  
  411. ;*********************************************
  412. ;Change Password
  413. ;*********************************************
  414.  
  415. ChangePasswd:
  416.  send    "\n\nWhat do you want to change your password to?(Enter to cancel) "
  417.     echo    off
  418.     input    $psw1 "\r"
  419.     if     $psw1 == "" then goto NoCHP
  420.     echo    on
  421.     send    "\nOne time more, thanks "
  422.     echo    off
  423.     input    $psw2 "\r"
  424.     echo    on
  425.     IF    !$psw1 == $psw2 THEN goto ChPErr
  426.     CLI "rename >nil: \""$userdir$name$pass"\" to \""$userdir$name$psw1"\""
  427.     IF    $CoSys == "TRUE" then goto CoSysopChpsw
  428.     IF    $SysAcc == "TRUE" then goto SysopChpsw
  429. ChaPsw:    send    "\n\nPassword changed \n\n"
  430.     write    $dir"log" $date"  Changed passwd from "$pass" to "$psw1"\n"
  431.     SET    $pass = $psw1
  432.     return
  433. NoCHP:
  434.     echo    on
  435.     return
  436. ChPErr:
  437.     send    "\nSomething wrong there, try again.\n"
  438.     goto    ChangePasswd
  439. CoSysopChpsw:
  440.     CLI "rename >nil: \""$Cosysop$name$pass"\" to \""$Cosysop$name$psw1"\""
  441.     goto ChaPsw
  442. SysopChpsw:
  443.     CLI "rename >nil: \""$Sysop$name$pass"\" to \""$Sysop$name$psw1"\""
  444.     goto ChaPsw
  445.  
  446.  
  447. ;*******************************************************
  448. ;List users who have logged in
  449. ;*******************************************************
  450. ListUsers:
  451.     send    "\nUsers up to "$date"\n"
  452.     ascsend    $dir"user"
  453.     write    $dir"log" $date"  Listed Users\n"
  454.     return
  455.  
  456. ;********************************************************
  457. ;File menu
  458. ;********************************************************
  459. FileMenu:
  460.     send    "\nFile command (? or ! for menu): "
  461.     input    $cmd "\r"
  462.     send    "\n"
  463.     IF $cmd == "?" THEN ascsend $menudir".menu1"
  464.     IF $cmd == "!" THEN ascsend $menudir"menu1"
  465.     IF $cmd == ""  THEN return
  466.     IF $cmd == "Q" THEN return
  467.     IF $cmd == "L" THEN gosub ListFiles
  468.     IF $cmd == "D" THEN gosub Download
  469.     IF $cmd == "U" THEN gosub Upload
  470.     IF $cmd == "V" THEN gosub ViewZOO
  471.     IF $cmd == "S" THEN gosub QListFiles
  472.     IF $cmd == "EXT" THEN gosub ExtractZOO
  473.     IF $cmd == "ADD" THEN gosub AddFile
  474.     IF $cmd == "DEL" THEN gosub Remove
  475.     IF $cmd == "DIR" THEN gosub Show
  476.     IF $cmd == "GET" THEN gosub GetHold
  477.     goto    FileMenu
  478.  
  479.  
  480. ;********************************************************
  481. ;List files in download directory
  482. ;********************************************************
  483. ListFiles:
  484.     send    "\n"
  485.     CLI     $list" "$dldir
  486.     return
  487.  
  488.  
  489. ;********************************************************
  490. ;List files in download directory quick
  491. ;********************************************************
  492. QListFiles:
  493.     send    "\n"
  494.     CLI     "C:ls "$dldir
  495.     return
  496.  
  497.  
  498. ;********************************************************
  499. ;Download file
  500. ;********************************************************
  501. Download:
  502.     IF EXISTS $UlDldir$name"UL" then goto DownlOK1
  503.     send    "\nNo files up, no files down....\n"
  504.     return
  505. DownlOK1:
  506.     send    "\nFilename: "
  507.     input    $file "\r"
  508.     send    "\n"
  509.     IF $file == "" THEN return
  510.     IF exists $dldir$file THEN goto DownlOK
  511.     send    "The file '"$file"' does not exist!\n"
  512.     return
  513. DownlOK:
  514.     send    "Choose protocol (B,G,X,Y,Z)\n"
  515.     send    "B=Ymodem Batch, G=Ymodem-G :"
  516.     input    $proto "\r"
  517.     send    "\n"
  518.     IF $proto == "" THEN return
  519.     IF $proto == "X" THEN goto XDownload
  520.     IF $proto == "Y" THEN goto YDownload
  521.     IF $proto == "Z" THEN goto ZDownload
  522.     IF $proto == "B" THEN goto BDownload
  523.     IF $proto == "G" THEN goto GDownload
  524.     send    "Illegal protocol!\n"
  525.     goto     DownlOK
  526. XDownload:
  527.     send    "Waiting...\n"
  528.     upload    $dldir$file,x
  529.     write    $dir"log" $date"  Downloaded "$file" (Xmodem)\n"
  530.     write    $UlDldir$name"DL" $file"\n"
  531.     return
  532. YDownload:
  533.     send    "Waiting...\n"
  534.     upload    $dldir$file,y
  535.     write    $dir"log" $date"  Downloaded "$file" (Ymodem)\n"
  536.     write    $UlDldir$name"DL" $file"\n"
  537.     return
  538. ZDownload:
  539.     send    "Waiting...\n"
  540.     upload    $dldir$file,z
  541.     write    $dir"log" $date"  Downloaded "$file" (Zmodem)\n"
  542.     write    $UlDldir$name"DL" $file"\n"
  543.     return
  544. BDownload:
  545.     send    "Waiting...\n"
  546.     upload    $dldir$file,b
  547.     write    $dir"log" $date"  Downloaded "$file" (Ymodem-Batch)\n"
  548.     write    $UlDldir$name"DL" $file"\n"
  549.     return
  550. GDownload:
  551.     IF    $hostMNPARQ == "FALSE" then goto NoGDL
  552.     send    "Waiting...\n"
  553.     upload    $dldir$file,g
  554.     write    $dir"log" $date"  Downloaded "$file" (Ymodem-G)\n"
  555.     write    $UlDldir$name"DL" $file"\n"
  556.     return
  557. NoGDL:
  558.     send    "\n\nThis BBS can't handle Ymodem-G, try another protocol\n"
  559.     goto    DownlOk
  560.  
  561. ;********************************************************
  562. ;Upload file
  563. ;********************************************************
  564. Upload:
  565.     send    "\nFilename: "
  566.     input    $file "\r"
  567.     send    "\n"
  568.     IF $file == "" THEN return
  569.     IF !EXISTS $uldir$file THEN goto UploadOK
  570.     send    "The file '"$file"' allready exists!\n"
  571.     return
  572. UploadOK:
  573.     send    "Describe the file: "
  574.     input    $desc "\r"
  575.     send    "\n"
  576. GetProto:
  577.     send    "Choose protocol (B,G,X,Y,Z)\n"
  578.     send    "B=Ymodem Batch, G=Ymodem-G: "
  579.     input    $proto "\r"
  580.     send    "\n"
  581.     IF $proto == "" THEN return
  582.     IF $proto == "X" THEN goto XUpload
  583.     IF $proto == "Y" THEN goto YUpload
  584.     IF $proto == "Z" THEN goto ZUpload
  585.     IF $proto == "B" THEN goto BUpload
  586.     IF $proto == "G" THEN goto GUpload
  587.     send    "Illegal protocol!\n"
  588.     goto     GetProto
  589. XUpload:
  590.     send    "Waiting...\n"
  591.     download $uldir$file,x
  592.     write    $dir"log" $date"  Uploaded "$file" (Xmodem)\n"
  593.     IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  594.     IF EXISTS $uldir$file THEN write $UlDldir$name"UL" $file"\n"
  595.     return
  596. YUpload:
  597.     send    "Waiting...\n"
  598.     download $uldir$file,y
  599.     write    $dir"log" $date"  Uploaded "$file" (Ymodem)\n"
  600.     IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  601.     IF EXISTS $uldir$file THEN write $UlDldir$name"UL" $file"\n"
  602.     return
  603. ZUpload:
  604.     send    "Waiting...\n"
  605.     download $uldir$file,z
  606.     write    $dir"log" $date"  Uploaded "$file" (Zmodem)\n"
  607.     IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  608.     IF EXISTS $uldir$file THEN write $UlDldir$name"UL" $file"\n"
  609.     return
  610. BUpload:
  611.     send    "Waiting...\n"
  612.     download $uldir$file,b
  613.     write    $dir"log" $date"  Uploaded "$file" (Ymodem-Batch)\n"
  614.     IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  615.     IF EXISTS $uldir$file THEN write $UlDldir$name"UL" $file"\n"
  616.     return
  617. GUpload:
  618.     IF    $hostMNPARQ == "FALSE" then goto NoGUL
  619.     send    "Waiting...\n"
  620.     download $uldir$file,g
  621.     write    $dir"log" $date"  Uploaded "$file" (Ymodem-g)\n"
  622.     IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  623.     IF EXISTS $uldir$file THEN write $UlDldir$name"UL" $file"\n"
  624.     return
  625. NoGUL:
  626.         send    "\n\nThis BBS can't handle Ymodem-G, try another protocol\n"
  627.     goto    GetProto
  628.  
  629. ;********************************************************
  630. ;Bulletin menu
  631. ;********************************************************
  632. BullMenu:
  633.     ascsend    $menudir".menu2"
  634. bull:    send    "\nBulletin numner (? or ! for menu): "
  635.     input    $cmd "\r"
  636.     send    "\n"
  637.     IF $cmd == "?"  THEN goto BullMenu
  638.     IF $cmd == "!"    THEN goto BullMe
  639.     IF $cmd == ""   THEN return
  640.     IF $cmd == "Q"  THEN return
  641.     IF exists $bulldir"bull"$cmd THEN goto ShowBull
  642.     send    "Illegal bulletin-number!\n"
  643.     goto    bull
  644. BullMe:
  645.     ascsend    $menudir"menu2"
  646.     goto    bull
  647. ShowBull:
  648.     send    "\n"
  649.     ascsend    $bulldir"bull"$cmd
  650.     write    $dir"log" $date"  Read bulletin #"$cmd"\n"
  651.     goto    bull
  652.  
  653.  
  654. ;********************************************************
  655. ;Sysop menu
  656. ;********************************************************
  657. SysopMenu:
  658.     ascsend $menudir"menu3"
  659. Sysop:
  660.     IF $sysacc == "TRUE" THEN goto SysOK
  661.     send    "Nope, youre not allowed!\n"
  662.     write    $dir"log" $date"  Attempted restricted command\n"
  663.     return
  664. SysOK:    send    "\nSysop Command (? for menu): "
  665.     input    $cmd "\r"
  666.     send    "\n"
  667.     IF $cmd == "?" THEN goto SysopMenu
  668.     IF $cmd == "Q" THEN return
  669.     IF $cmd == ""  THEN return
  670.     IF $cmd == "L" THEN goto ListLog
  671.     IF $cmd == "R" THEN goto Priv
  672.     IF $cmd == "D" THEN goto DeleteLog
  673.     IF $cmd == "C" THEN goto DeleteComm
  674.     IF $cmd == "B" THEN goto RemoteBackup
  675.     IF $cmd == "S" THEN goto StartScript
  676.  
  677. ;********************************************************
  678. ;Execute DOS command
  679. ;********************************************************
  680.     write    $dir"log" $date"  Executed DOS command: "$cmd"\n"
  681.     send    "\n Commands that can be executed from remote is:\n"
  682.     CLI    "C:ls "$doscomm
  683.     if    $local == "FALSE" then goto NoLocalDos 
  684.     CLI    $cmd
  685.     goto sysok
  686. NoLocalDos:
  687.     CLI    $doscomm$cmd
  688.     goto sysok
  689.  
  690. NoDos:
  691.     send    "\n\nOnly available in local mode, sorry!!\n\n"
  692.     goto sysok
  693.     goto    sysok
  694.  
  695.  
  696. ;********************************************************
  697. ;Delete log file
  698. ;********************************************************
  699. DeleteLog:
  700.     if    $local == "FALSE" then goto NoDos 
  701.     IF    $cosys == "TRUE" then goto sysok
  702.     send    "\nSäker (Enter=N)? "
  703.     input    $cmd "\r"
  704.     send    "\n"
  705.     IF !$cmd == "Y" THEN goto sysok
  706.     CLI    "delete "$dir"log"
  707.     write    $dir"log" $date"  Started new log\n"
  708.     goto sysok
  709.  
  710.  
  711. ;********************************************************
  712. ;Delete private messages
  713. ;********************************************************
  714. DeleteComm:
  715.     if    $local == "FALSE" then goto NoDos 
  716.     IF    $cosys == "TRUE" then goto sysok
  717.     send    "\nDelete all private messages (Enter=N)? "
  718.     input    $cmd "\r"
  719.     send    "\n"
  720.     IF !$cmd == "Y" then goto sysok
  721.     CLI "delete >nil: "$msgsdir"Comments"
  722.     write    $dir"log" $date"  Private messages deleted\n"
  723.     goto sysok
  724.  
  725.  
  726. ;********************************************************
  727. ;List log file
  728. ;********************************************************
  729. ListLog:
  730.     send    "\n"
  731.     ascsend    $dir"log"
  732.     write    $dir"log" $date"  Listed Log\n"
  733.     goto sysok
  734.  
  735.  
  736. ;********************************************************
  737. ;Remote Backup
  738. ;********************************************************
  739. RemoteBackup:
  740.     send    "\nRemote Backup started.\n"
  741.     CLI    "run >nil: <nil: copy ncomm:host to df1:host all clone"
  742.     write    $dir"log" $date"  Started Remote Backup\n"
  743.     goto sysok
  744.  
  745. ;********************************************************
  746. ;Start a script
  747. ;********************************************************
  748. StartScript:
  749.     Send    "\n\nThis is a Point of No Return!!!\n\n"
  750.     send    "When the script is started there is _NO WAY BACK_\n\n"
  751.     Send    "Continue? (Enter=N)"
  752.         input   $Cont "\r"
  753.     If    $cont == "Y" THEN GOTO StartS1
  754.     goto    sysok    
  755. StartS1:
  756.     CHAIN    $dir"A.Script"
  757.  
  758. ;********************************************************
  759. ;Comment to sysop
  760. ;********************************************************
  761. Comment:
  762.     send    "\n\nSubject: "
  763.     input    $subject "\r"
  764.     IF $subject == "" then return
  765.     SET     $to = "Sysop"
  766.     SET    $mfile = "Comments"
  767.     SET    $mtype = "Comment to sysop"
  768.     goto    Writemess
  769.  
  770. ;********************************************************
  771. ;Messages menu
  772. ;********************************************************
  773. Messages:
  774.     ascsend $menudir".menu5"
  775. Mess1:    send    "\nMessage command (? or ! for menu): "    
  776.     input    $cmd "\r"
  777.     send    "\n"
  778.     IF $cmd == "?"  THEN goto Messages
  779.     IF $cmd == "!"    THEN goto Mess2
  780.     IF $cmd == ""   THEN return
  781.     IF $cmd == "Q"  THEN return
  782.     IF $cmd == "R"    THEN goto Mess3
  783.     IF $cmd == "W"  THEN goto Mess3
  784.     GOTO    Mess1
  785. Mess3:
  786.     send    "\nArea number (? or ! for menu): "
  787.     input    $area "\r"
  788.     IF $area == "?"  THEN goto Mess3a
  789.     IF $area == "!"    THEN goto Mess3b
  790.     send    "\n"
  791.     IF exists $msgsdir"messages"$area THEN goto Mess4
  792.     send    "Illegal Area-number!\n"
  793.     goto    Mess1
  794. Mess3a:    
  795.     ascsend $menudir".menu5"
  796.     goto     Mess3
  797. Mess3b:
  798.     ascsend    $menudir"menu5"
  799.     goto    Mess3
  800. Mess2:    ascsend    $menudir"menu5"
  801.     goto     Mess1
  802. Mess4:    IF $cmd =="R"    THEN goto Read
  803.     gosub     Enter
  804.     goto    Mess1
  805.         
  806. ;********************************************************
  807. ;Enter message
  808. ;********************************************************
  809. Enter:
  810.     send    "\nTo (Enter=ALL): "
  811.     input    $to "\r"
  812.     IF $to == "" then SET $to = "ALL"
  813.     send    "\nSubject: "
  814.     input    $subject "\r"
  815.     IF $subject == "" then return
  816.     SET    $mfile = "messages"$area
  817.     SET    $mtype = "Area"$area
  818.     goto    Writemess
  819.  
  820.  
  821.  
  822. ;********************************************************
  823. ;Read public messages
  824. ;********************************************************
  825. Read:
  826.     ascsend    $msgsdir"messages"$area
  827.     write    $dir"log" $date"  Read message in area "$area"\n"
  828.     goto    Mess1
  829.  
  830.  
  831. ;********************************************************
  832. ;Read private messages
  833. ;********************************************************
  834. Priv:    IF !EXISTS $msgsdir"comments" then goto sysok
  835.     ascsend    $msgsdir"comments"
  836.     write    $dir"log" $date"  Read private messages.\n"
  837.     goto    sysok
  838.  
  839. ;********************************************************
  840. ;Handle NO CARRIER
  841. ;********************************************************
  842. NoCarrier:
  843.     write    $dir"log" $date"  CARRIER LOST\n"
  844.     gosub    logout
  845.     goto     main
  846.  
  847.  
  848. ;********************************************************
  849. ;View ZOO file
  850. ;********************************************************
  851. ViewZOO:
  852.     send    "\nGive the name of the  "$arch" file: "
  853.     input    $file "\r"
  854.     send    "\n"
  855.     IF $file == "" then return
  856.     IF exists $dldir$file then goto ViewOK
  857.     IF exists $dldir$file$arch then goto ViewOK
  858.     send    "The file does not exist!\n"
  859.     return
  860. ViewOK:    write    $dir"log" $date" "$arch" view of "$file"\n"
  861.     CLI    $alist$dldir$file
  862.     return
  863.  
  864.  
  865. ;********************************************************
  866. ;Extract ZOO file
  867. ;********************************************************
  868. ExtractZOO:
  869.     IF EXISTS $UlDldir$name"UL" then goto ExtraZ1
  870.     send    "\nNo files up, no files down....\n"
  871.     return
  872. ExtraZ1:
  873.         send    "\nGive the name of the  "$arch" file: "
  874.     input    $file "\r"
  875.     send    "\n"
  876.     IF $file == "" then return
  877.     IF exists $dldir$file then goto ExtOK
  878.     IF exists $dldir$file$arch then goto ExtOK
  879.     send    "The file does not exist!\n"
  880.     return
  881. ExtOK:    send    "\nGive the name of the file(s) to extract [Enter=all]: "
  882.     input    $files "\r"
  883.     write    $dir"log" $date"  Extracted "$file" "$files"\n"
  884.     send    "\n"
  885.     CLI    "delete >nil: "$tmp
  886.     write    $tmp "CD "$hold"\n"
  887.     write    $tmp $aextract$dldir$file" "$files"\n"
  888.     CLI    "execute "$tmp
  889.     return
  890.  
  891.  
  892. ;********************************************************
  893. ;Add file to HOLD
  894. ;********************************************************
  895. AddFile:
  896.     IF EXISTS $UlDldir$name"UL" then goto AddF1
  897.     send    "\nNo files up, no files down....\n"
  898.     return
  899. AddF1:
  900.     send    "\nFilename: "
  901.     input    $file "\r"
  902.     send    "\n"
  903.     IF $file == "" then return
  904.     IF exists $dldir$file then goto AddOK
  905.     send    "The file '"$file"' does not exist!\n"
  906.     return
  907. AddOK:    CLI    "COPY "$dldir$file" "$hold
  908.     write    $dir"log" $date"  Added "$file"\n"
  909.     return
  910.     
  911.  
  912. ;********************************************************
  913. ;Delete file(s) from HOLD
  914. ;********************************************************
  915. Remove:    send    "\nFilename: "
  916.     input    $file "\r"
  917.     send    "\n"
  918.     IF $file == "" then return
  919.     write    $dir"log" $date"  Deleted "$file"\n"
  920.     CLI    "delete \""$hold$file"\""
  921.     return
  922.  
  923.  
  924. ;********************************************************
  925. ;List files in HOLD directory
  926. ;********************************************************
  927. Show:
  928.     send    "\n"
  929.     CLI     $list" "$hold
  930.     return
  931.  
  932.  
  933. ;********************************************************
  934. ;Download files in HOLD directory
  935. ;********************************************************
  936. GetHold:
  937.     send    "Wait while I pack the files...\n"
  938.     CLI    "delete >nil: "$holdzoo
  939.     CLI    $apack$holdzoo" "$hold"*"
  940. GetPr:
  941.     send    "Choose protocol (B,G,X,Y,Z)\n"
  942.     send    "B=Ymodem Batch, G=Ymodem-G: "
  943.     input    $proto "\r"
  944.     send    "\n"
  945.     IF !$proto == "" THEN goto Get1
  946.     CLI    "delete >nil: "$holdzoo
  947.     return
  948. Get1:    IF $proto == "X" THEN goto XGet
  949.     IF $proto == "Y" THEN goto YGet
  950.     IF $proto == "Z" THEN goto ZGet
  951.     IF $proto == "B" THEN goto BGet
  952.     IF $proto == "G" THEN goto GGet
  953.     send    "Illegal protocol!\n"
  954.     goto     GetPr
  955. XGet:
  956.     send    "Waiting...\n"
  957.     upload    $holdzoo,x
  958.     write    $dir"log" $date"  Downloaded HOLD"$arch" (Xmodem)\n"
  959.     write    $UlDldir$name"DL" "HOLD"$arch":\n"
  960.     CLI    "list >>\""$UlDldir$name"DL\" "$hold" quick nohead"
  961.     CLI    "delete >nil: "$holdzoo
  962.     return
  963. YGet:
  964.     send    "Waiting...\n"
  965.     upload    $holdzoo,y
  966.     write    $dir"log" $date"  Downloaded HOLD"$arch" (Ymodem)\n"
  967.     write    $UlDldir$name"DL" "HOLD"$arch":\n"
  968.     CLI    "list >>\""$UlDldir$name"DL\" "$hold" quick nohead"
  969.     CLI    "delete >nil: "$holdzoo
  970.     return
  971. ZGet:
  972.     send    "Waiting...\n"
  973.     upload    $holdzoo,z
  974.     write    $dir"log" $date"  Downloaded HOLD"$arch" (Zmodem)\n"
  975.     write    $UlDldir$name"DL" "HOLD"$arch":\n"
  976.     CLI    "list >>\""$UlDldir$name"DL\" "$hold" quick nohead"
  977.     CLI    "delete >nil: "$holdzoo
  978.     return
  979. BGet:
  980.     send    "Waiting...\n"
  981.     upload    $holdzoo,b
  982.     write    $dir"log" $date"  Downloaded HOLD"$arch" (Ymodem-Batch)\n"
  983.     write    $UlDldir$name"DL" "HOLD"$arch":\n"
  984.     CLI    "list >>\""$UlDldir$name"DL\" "$hold" quick nohead"
  985.     CLI    "delete >nil: "$holdzoo
  986.     return
  987. GGet:
  988.     IF    $hostMNPARQ == "FALSE" then goto NoGGet
  989.     send    "Waiting...\n"
  990.     upload    $holdzoo,z
  991.     write    $dir"log" $date"  Downloaded HOLD"$arch" (Ymodem-G)\n"
  992.     write    $UlDldir$name"DL" "HOLD"$arch":\n"
  993.     CLI    "list >>\""$UlDldir$name"DL\" "$hold" quick nohead"
  994.     CLI    "delete >nil: "$holdzoo
  995.     return
  996. NoGGet:
  997.         send    "\n\nThis BBS can't handle Ymodem-G, try another protocol\n"
  998.     goto    GetPr
  999.  
  1000. ;********************************************************
  1001. ;Letter menu, private mail
  1002. :********************************************************
  1003. LetterMenu:
  1004.     send    "\nLetter command (? or ! for menu): "
  1005.     input    $cmd "\r"
  1006.     send    "\n"
  1007.     IF $cmd == "?" THEN ascsend $menudir".menu4"
  1008.     IF $cmd == "!" THEN ascsend $menudir"menu4"
  1009.     IF $cmd == ""  THEN return
  1010.     IF $cmd == "Q" THEN return
  1011.     IF $cmd == "R" THEN gosub ReadLetter
  1012.     IF $cmd == "W" THEN gosub WriteLetter
  1013.     IF $cmd == "E" THEN gosub DeleteLetter
  1014.     IF $cmd == "G" THEN gosub GrabMail
  1015.     goto    LetterMenu
  1016.  
  1017. ;********************************************************
  1018. ;Enter message
  1019. ;********************************************************
  1020. WriteLetter:
  1021.     send    "\nTo: (enter to abort) "
  1022.     input    $to "\r"
  1023.     IF    $to == "" then return
  1024.     IF    EXISTS $userdir$to THEN goto WLCont
  1025.     send    "There is no user with the name "$to
  1026.     goto    WriteLetter
  1027. WLCont:    send    "\nSubject: (enter to abort) "
  1028.     input    $subject "\r"
  1029.     IF    $subject == "" then return
  1030.     SET    $mtype = "Private"
  1031.     SET    $mfile = $to
  1032.     goto    writemess
  1033.  
  1034.  
  1035.  
  1036. ;********************************************************
  1037. ;Read private messages
  1038. ;********************************************************
  1039. ReadLetter:
  1040.     IF !EXISTS $msgsdir$name then goto NoLetter
  1041.     ascsend    $msgsdir$name
  1042.     write    $dir"log" $date"  Read private letters \n"
  1043.     return
  1044. NoLetter:
  1045.     send "No private mail to "$name"\n"
  1046.     return    
  1047.  
  1048. ;********************************************************
  1049. ;Delete private messages
  1050. ;********************************************************
  1051. DeleteLetter:
  1052.     send    "\nErase all private mail? (Enter=N) "
  1053.     input    $cmd "\r"
  1054.     send    "\n"
  1055.     IF !$cmd == "Y" then return
  1056.     CLI "delete >nil: \""$msgsdir$name"\""
  1057.     write    $dir"log" $date"  Private messages deleted\n"
  1058.     return
  1059.  
  1060.  
  1061. ;********************************************************
  1062. ;Grab all mail
  1063. ;********************************************************
  1064. GrabMail:
  1065.     CLI "copy >nil: \""$msgsdir$name"\" to \""$hold"\""
  1066.     send    "\n\nAdd messagareas (enter=Y) ?"
  1067.     input    $cmd "\r"
  1068.     send    "\n\n"
  1069.  if !$cmd == "N" then CLI "copy >nil: \""$msgsdir"messages#?\" to \""$hold"\""
  1070.     send    "\n\nAdd Bulletines (enter=Y) ?"
  1071.     input    $cmd "\r"
  1072.     send    "\n\n"
  1073.  if !$cmd == "N" then CLI "copy >nil: \""$bulldir"bull#?\" to \""$hold"\""
  1074.     write    $dir"log" $date"  Fetched mail\n"
  1075.     goto    gethold
  1076.  
  1077. ;********************************************************
  1078. ;Enter message
  1079. ; $to        = to who
  1080. ; $mfile    = to wich file
  1081. ; $mtype    = type of message
  1082. ;********************************************************
  1083. WriteMess:
  1084.     SET    $header = "\n\nFrom: "$name"\n"
  1085.     SET    $header = $header"To: "$to"\nSubject: "$subject"\n"
  1086.     SET    $header = $header"Date: "$date"\n"
  1087.     SET    $header = $header"-------------------------------\n"
  1088.     write    $msgsdir$mfile $header
  1089.     send    $header
  1090.     send    "[Write your message below; "
  1091.     send    "end with Ctrl-Z on an empty line]\n\n"
  1092.     when    "^Z" goto endWL
  1093. WLent:    input    $line "\r"
  1094.     send    "\n"
  1095.     write    $msgsdir$mfile $line"\n"
  1096.     goto     WLent
  1097. EndWL:    dlwhen
  1098.     send    "\nMessage saved!^G\n"
  1099.     write    $dir"log" $date"  Entered "$mtype" message\n"
  1100.     return
  1101.